<include file="public/layout" />
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
	<div class="fixed-bar">
		<div class="item-title">
			<div class="subject">
				<h3>微信信息记录</h3>
				<h5>网站系统会员索引与管理</h5>
			</div>
		</div>
	</div>
	<!-- 操作说明 -->
	<div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); width: 99%; height: 100%;">
		<div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
			<h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
			<span title="收起提示" id="explanationZoom" style="display: block;"></span>
		</div>
		<ul>
			<li>微信信息记录, 可以查看哪个管理员发送的信息.</li>
		</ul>
	</div>
	<div class="flexigrid">
		<div class="mDiv">
			<div class="ftitle">
				<h3>信息列表</h3>
				<h5>(共<span id="user_count"></span>条记录)</h5>
			</div>
			<div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
			<form class="navbar-form form-inline"  id="search-form2" onsubmit="return false">
				<div class="sDiv">
					<div class="sDiv2">
					</div>
				</div>
			</form>
		</div>
		<div class="hDiv">
			<div class="hDivBox">
				<table cellspacing="0" cellpadding="0">
					<thead>
					<tr>
						<th class="sign" axis="col0">
							<div style="width: 24px;"><i class="ico-check"></i></div>
						</th>
						<th align="left" abbr="user_id" axis="col3" class="">
							<div style="text-align: center; width: 40px;" class="">ID</div>
						</th>
						<th align="left" abbr="nickname" axis="col4" class="">
							<div style="text-align: center; width: 150px;" class="">发送人</div>
						</th>
						<th align="center" abbr="level" axis="col5" class="">
							<div style="text-align: center; width: 200px;" class="">标题</div>
						</th>
						<th align="center" abbr="profit_level" axis="col5" class="">
							<div style="text-align: center; width: 300px;" class="">内容</div>
						</th>
						<th align="center" abbr="total_amount" axis="col6" class="">
							<div style="text-align: center; width: 300px;" class="">链接</div>
						</th>
						<th align="center" abbr="profit_amount" axis="col6" class="">
							<div style="text-align: center; width: 150px;" class="">使用模板</div>
						</th>
						<th align="center" abbr="profit_amount" axis="col6" class="">
							<div style="text-align: center; width: 200px;" class="">创建时间</div>
						</th>
						<th align="center" abbr="email" axis="col6" class="">
							<div style="text-align: center; width: 100px;" class="">操作</div>
						</th>
						<th style="width:100%" axis="col7">
							<div></div>
						</th>
					</tr>
					</thead>
				</table>
			</div>
		</div>
		<div class="tDiv">
			<div class="tDiv2">
				<div class="fbutton">
					<a href="{:U('Admin/wemsg/add_msg')}">
						<div class="add" title="添加微信消息">
							<span><i class="fa fa-plus"></i>添加微信消息</span>
						</div>
					</a>
				</div>
			</div>
			<div style="clear:both"></div>
		</div>
		<div class="bDiv" style="height: auto;" id="ajax_return">
		</div>
	</div>
</div>
<script>
	$(document).ready(function(){
		// 点击刷新数据
		var ssort = 'sdesc';
		var on_sclick = 0;
		$('.hDivBox > table>thead>tr>th').hover(
				function () {
					if(typeof($(this).attr('abbr')) == "undefined"){
						return false;
					}
					$(this).addClass('thOver');
					if($(this).hasClass('sorted')){
						if(ssort == 'sdesc'){
							$(this).find('div').removeClass('sdesc');
							$(this).find('div').addClass('sasc');
						}else{
							$(this).find('div').removeClass('sasc');
							$(this).find('div').addClass('sdesc');
						}
					}else{
						$(this).find('div').addClass(ssort);
					}
				}, function () {
					if(typeof($(this).attr('abbr')) == "undefined"){
						return false;
					}
					if(on_sclick == 0){
						if($(this).hasClass('sorted')){
							if(ssort == 'sdesc'){
								$(this).find('div').removeClass('sasc');
								$(this).find('div').addClass('sdesc');
							}else{
								$(this).find('div').removeClass('sdesc');
								$(this).find('div').addClass('sasc');
							}
						}else{
							$(this).find('div').removeClass(ssort);
						}
					}
					$(this).removeClass("thOver");
					on_sclick = 0;
				}
		);
		$('.hDivBox > table>thead>tr>th').click(function(){
			if(typeof($(this).attr('abbr')) == "undefined"){
				return false;
			}
			if($(this).hasClass('sorted')){
				$(this).find('div').removeClass(ssort);
				if(ssort == 'sdesc'){
					ssort = 'sasc';
				}else{
					ssort = 'sdesc';
				}
				$(this).find('div').addClass(ssort);
				on_sclick = 1;
			}else{
				$('.hDivBox > table>thead>tr>th').removeClass('sorted');
				$('.hDivBox > table>thead>tr>th').find('div').removeClass(ssort);
				$(this).addClass('sorted');
				$(this).find('div').addClass(ssort);
				var hDivBox_th_index = $(this).index();
				var flexigrid_tr =   $('#flexigrid > table>tbody>tr')
				flexigrid_tr.each(function(){
					$(this).find('td').removeClass('sorted');
					$(this).children('td').eq(hDivBox_th_index).addClass('sorted');
				});
			}
			sort($(this).attr('abbr'));
		});

		$('.fa-refresh').click(function(){
			location.href = location.href;
		});
		ajax_get_table('search-form2',1);

	});
	//选中全部
	$('.hDivBox .sign').click(function(){
		var sign = $('#flexigrid > table>tbody>tr');
		if($(this).parent().hasClass('trSelected')){
			sign.each(function(){
				$(this).removeClass('trSelected');
			});
			$(this).parent().removeClass('trSelected');
		}else{
			sign.each(function(){
				$(this).addClass('trSelected');
			});
			$(this).parent().addClass('trSelected');
		}
	})

	//发送站内信
	function send_wxmessage()
	{
		var obj = $('.trSelected');
		var url = "{:U('Admin/User/sendwxMessage')}";
		if(obj.length > 0){
			var check_val = [];
			obj.each(function(){
				check_val.push($(this).attr('data-id'));
			});
//			url += "?user_id_array="+check_val;
			layer.open({
				type: 2,
				title: '微信消息',
				shadeClose: true,
				shade: 0.8,
				area: ['580px', '480px'],
				content: url
			});
		}else{
			layer.msg('请选择会员');
		}

	}

	// ajax 抓取页面
	function ajax_get_table(tab,page){
		cur_page = page; //当前页面 保存为全局变量
		$.ajax({
			type : "POST",
			url:"/index.php/Admin/Wemsg/ajaxindex/p/"+page,//+tab,
			data : $('#'+tab).serialize(),// 你的formid
			success: function(data){
				$("#ajax_return").html('');
				$("#ajax_return").append(data);
			}
		});
	}


	// 点击排序
	function sort(field)
	{
		$("input[name='order_by']").val(field);
		var v = $("input[name='sort']").val() == 'desc' ? 'asc' : 'desc';
		$("input[name='sort']").val(v);
		ajax_get_table('search-form2',cur_page);
	}

</script>
</body>
</html>